package com.fast.fastenjoy.base.web.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.fast.fastenjoy.base.utils.ApplicationContextUtils;

/**
 * Spring ContextListener
 * @author chenliaohua
 *
 */
public class ContextListener extends ContextLoaderListener{

	@Override
	public void contextInitialized(ServletContextEvent event) {
		
		super.contextInitialized(event);
		
		ServletContext servletContext = event.getServletContext();
		
		WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
		
		ApplicationContextUtils.setApplicationContext(wac);
		
	}

}
